//
//  SendStatusViewController.m
//  sys_eric
//
//  Created by mac on 11-11-17.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "SendStatusViewController.h"

@implementation SendStatusViewController
@synthesize textField0;
@synthesize textField1;
@synthesize textField2;
@synthesize datePicker;


//点击textfield弹出时间选取器的方法和使用
-(IBAction)textDidEndEditing:(id)sender
{
    [sender resignFirstResponder];
}

-(IBAction)touchBackground:(id)sender
{
    [textField0 resignFirstResponder];
    [textField1 resignFirstResponder];
    [textField2 resignFirstResponder];
}

-(IBAction)query:(id)sender
{
    NSLog(@"CHAXUN");
}

-(void)textFieldDidBeginEditing:(UITextField *)textField
{
    
    textField.inputView=datePicker;
   
}
-(void)textFieldDidEndEditing:(UITextField *)textField
{
    NSDate *date=[datePicker date];
    NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"]; // 这里是用大写的 H，如果是小写就会12小时制
    NSString* dateStr = [dateFormatter stringFromDate:date];
    NSString *message=[[NSString alloc]initWithFormat:@"%@",dateStr];
    textField.text=message;
    [message release];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [textField0 release];
    [textField1 release];
    [textField2 release];
    [datePicker release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    self.title=@"发送情况";
    datePicker=[[UIDatePicker alloc]init];
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    self.textField0=nil;
    self.textField1=nil;
    self.textField2=nil;
    self.datePicker=nil;
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
